cmake_minimum_required (VERSION 2.8.11)
if(APPLE)
set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -stdlib=libc++")
endif()

set (ROOT_DIR ..)
set (INCLUDE_DIR ${ROOT_DIR}/include)
set (INCLUDE_PUBLIC_DIR ${INCLUDE_DIR}/public)
set (3RDPARTY_LIB ${PROJECT_SOURCE_DIR}/Engine/3rdParty)
include_directories (
	${INCLUDE_DIR}
	${INCLUDE_PUBLIC_DIR}
)

if(WIN32)
	# Add glew library
	add_library(glew STATIC IMPORTED)
	if(CMAKE_SIZEOF_VOID_P EQUAL 8)
		set_property(TARGET glew PROPERTY IMPORTED_LOCATION ${3RDPARTY_LIB}/glew/bin/x64/glew32s.lib)
	else()
		set_property(TARGET glew PROPERTY IMPORTED_LOCATION ${3RDPARTY_LIB}/glew/bin/x86/glew32s.lib)
	endif()
	# Add OpenGL library
	find_library(opengl32 OpenGL32)

	include_directories (
		${ROOT_DIR}/3rdParty/glew/include
	)
	set (OS_SPECIFIC_LIBS
		opengl32
	)
elseif(APPLE)
	#INCLUDE_DIRECTORIES ( /System/Library/Frameworks )
   #FIND_LIBRARY(COCOA_LIBRARY Cocoa)
   #FIND_LIBRARY(GLUT_LIBRARY GLUT )
   find_library(OpenGL_LIBRARY OpenGL )
   #MARK_AS_ADVANCED (COCOA_LIBRARY
   #                  GLUT_LIBRARY
   #                  OpenGL_LIBRARY)
   set(EXTRA_LIBS ${OpenGL_LIBRARY})
endif()

set (RENDER_FILES
	${INCLUDE_DIR}/EngineRender.h
	EngineRender.cpp
	DXRenderContext.h
	DXRenderContext.cpp
	DXRenderDevice.h
	DXRenderDevice.cpp
	OGLDefs.h
	OGLRenderContext.h
	OGLRenderContext.cpp
	OGLRenderDevice.h
	OGLRenderDevice.cpp
	EglWrapper.h
	EglWrapper.cpp
)

add_library (VEngineRenderer STATIC
	${RENDER_FILES}
)

target_link_libraries(VEngineRenderer ${EXTRA_LIBS})